package com.rookieci.lib;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;

/**
 * Created by 52463 on 2018/3/23.
 */
public class LibApp {
    private static Context context;
    private static Handler handler;

    public static void init(Context context) {
        LibApp.context = context;
    }

    public static void init(Context context, Handler handler) {
        LibApp.context = context;
        LibApp.handler = handler;
    }

    public static void setContext(Context context) {
        LibApp.context = context;
    }

    public static Context getContext() {
        return context;
    }

    public static void setHandler(Handler handler) {
        LibApp.handler = handler;
    }

    public static Handler getHandler() {
        if (handler == null) handler = new Handler(Looper.getMainLooper());
        return handler;
    }
}
